package com.test.util;


public enum TemplatePicPositionType {

    model_pic(1) {
        @Override
        public String description() {
            return "模特图";
        }
    },
    still_life_pic(2) {
        @Override
        public String description() {
            return "静物图";
        }
    },
    group_pic(3) {
        @Override
        public String description() {
            return "组合图";
        }
    },
    detail_pic(4) {
        @Override
        public String description() {
            return "细节图";
        }
    },
    tag_pic(5) {
        @Override
        public String description() {
            return "吊牌图";
        }
    },;

    private int actualValue;

    private TemplatePicPositionType(int actualValue) {
        this.actualValue = actualValue;
    }

    public int value() {
        return this.actualValue;
    }

    public int getActualValue() {
		return actualValue;
	}

	public void setActualValue(int actualValue) {
		this.actualValue = actualValue;
	}

    public abstract String description();

    public static TemplatePicPositionType from(int value) {
        for (TemplatePicPositionType en : TemplatePicPositionType.values()) {
            if (en.getActualValue() == value) {
                return en;
            }
        }
        return TemplatePicPositionType.model_pic;
    }

    public static TemplatePicPositionType from(String name) {
        for (TemplatePicPositionType en : TemplatePicPositionType.values()) {
            if (en.name().equals(name)) {
                return en;
            }
        }
        return TemplatePicPositionType.model_pic;
    }
}
